package com.choupin.choupin.controller;


import com.choupin.choupin.entity.JsonResult;
import com.choupin.choupin.service.impl.PhoneCodeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PhoneCodeController {

    @Autowired
    private PhoneCodeServiceImpl phoneCodeService;

    // 获取手机验证码
    @GetMapping("/getPhoneCode")
    public JsonResult<String> getPhoneCode(@RequestParam("phoneNumber") String phoneNumber) {
          JsonResult<String> jsonResult=new JsonResult<>();
          String code=phoneCodeService.generatePhoneCode(phoneNumber);
          jsonResult.setState(20);
          jsonResult.setData(code);
        return jsonResult;
    }

}
